use Getopt::Std;
#Input Arguments
getopt("t:i:a:o", \%args);
my $indfile = $args{i};
my $tpedfile = $args{t};
my $aimmarker = $args{a};
my $outputtped = $args{o};
open(WRBUFF,">$outputtped");
if($indfile eq "" || $tpedfile eq "" || $outputtped eq "" || $aimmarker eq "")
{
	die "input arguments are empty\n";
}
open IND,"$indfile" or die "no $indfile exists\n";
while($line = <IND>)
{
	chomp($line);
	@array = split(" ",$line);
	if($array[1] > 0.8)
	{
		$hash{$array[0]} = $array[1];
	}
}
open AIM,"$aimmarker" or die "no aimmarker file found\n";
while($line = <AIM>)
{
	chomp($line);
        if(exists($hash{$line}) )
	{
		$hash1{$line} = 1;
	}
}
open TPED,"$tpedfile" or die "no tped file found\n";
while($line=<TPED>)
{
	chomp($line);
	@array = split(" ",$line);
	if(exists($hash1{$array[1]}))
	{
		print WRBUFF $line."\n";
	}
}
